# -*- coding:utf-8 -*
from django.shortcuts import render_to_response,render,get_object_or_404
from django.template.loader import get_template
from django.template import Template, Context
from django.http import HttpResponse,HttpResponseRedirect
from django.views.decorators.csrf import csrf_exempt
import os





#首页
#def index( request ):
#                return render_to_response('devops/index.html')
#def server( request ):
#return render_to_response('devops/server.html')

#def release( request ):
#                return render_to_response('devops/release.html')
#def user( request ):
#                return render_to_response('devops/user.html')
#def user_login( request ):
#                return render_to_response('devops/login.html')



#执行命令
@csrf_exempt
#def t8080( request):
#        cmdstr = "echo test is ok"
#        f = os.popen(cmdstr)
#        res = f.read()
#        return HttpResponse(res)


def office( request ):
    p1 = request.GET.get('cmd')
    p2 = request.GET.get('post')
    cmd = '/bin/bash /root/scripts/tomcat_init.sh %s %s' %  (p1,p2)
    f = os.popen(cmd)
    res = f.read()
    return HttpResponse(res)
